package demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-07-07
 * Time: 20:29
 */
@Configuration
public class BeanConfig {

    @Bean("u1")
    public UserInfo userInfo1() {
        UserInfo userInfo = new UserInfo();
        userInfo.setId(2);
        userInfo.setName("lisi");
        userInfo.setAge(13);
        return userInfo;
    }

    @Bean
    public String name(){
        return "wangwu";
    }
    @Bean("u2")
    public UserInfo userInfo2(String name) {
        UserInfo userInfo = new UserInfo();
        userInfo.setId(1);
        userInfo.setName(name);
        userInfo.setAge(12);
        return userInfo;
    }
}
